﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EC2011_hk1_BT3_1041061_1041129_1041130
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        string tenPhong;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int Id;
                Id = int.Parse(Request.QueryString["Id"]);
                string sql = "select showcontrol from departments where departmentid='"+Id+"'";
                string sql1 = "select name from departments where departmentid ='"+Id+"'";
                Database db = new Database();
                db.connect();
                object LoaiControl = db.executeScalar(sql);
                string LoaiHienThi = LoaiControl.ToString();
                if (LoaiHienThi.Equals("Gridview"))
                {
                    GridView1.Visible = true;
                    DetailsView1.Visible = false;
                    Repeater1.Visible = false;
                    DataList2.Visible = false;
                }
                else if (LoaiHienThi.Equals("Detailview"))
                {
                    DetailsView1.Visible = true;
                    GridView1.Visible = false;
                    Repeater1.Visible = false;
                    DataList2.Visible = false;
                }
                else if (LoaiHienThi.Equals("Repeater"))
                {
                    Repeater1.Visible = true;
                    GridView1.Visible = false;
                    DetailsView1.Visible =false;
                    DataList2.Visible = false;
                }
                else
                {
                    DataList2.Visible = true;
                    Repeater1.Visible = false;
                    GridView1.Visible = false;
                    DetailsView1.Visible = false;
                    
                }
                object tenP = db.executeScalar(sql1);
                tenPhong = tenP.ToString();
               
            }
        }
    }
}